package com.power.using.myapplication.myapp;

import android.app.Application;

/**
 * Created by 聪明一只哈 on 2019/9/6.
 * Time: 2019/9/6  17:18
 */
public class MyApp extends Application {

    private volatile static MyApp instance=null;//防止多个线程同时访问

    @Override
    public void onCreate() {
        super.onCreate();

    }

    //应用层的单例模式
    public static MyApp getInstance() {
        if (instance==null){
            synchronized (MyApp.class){
                if (instance==null){
                    instance=new MyApp();
                }
            }
        }
        return instance;
    }
}
